#ifndef FILEHANDLER_H
#define FILEHANDLER_H



#include "modelutils_global.h"



#include <AbstractSerializer.h>
#include <ItemRoot.h>
#include <QObject>
#include <QPointer>



class MODELUTILSSHARED_EXPORT FileHandler : public QObject
{
    Q_OBJECT

public:

    static FileHandler* instance();

    static void installSerializer(AbstractSerializer* serializer);

    static bool save(ItemRoot* item, const QString& file_path);
    static ItemRoot* open(const QString& file_path);

    static QList<ItemRoot*> openItems();


signals:

    void sigFileOpened();


protected:

    FileHandler(QObject *parent = 0);

    QPointer<AbstractSerializer> m_serializer;

    QList<ItemRoot*> m_openItems;

};

#endif // FILEHANDLER_H
